package com.stylefeng.guns.rest.modular.auth.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @ClassName: ReadProperties
 * @Description: 读取配置文件信息 TODO(这里用一句话描述这个类的作用)
 * @author kenan
 * @date 2018年4月27日
 * 
 */
public class ReadProperties {

	/**
	 * @Title: getProperties @Description: 读取自定义配置文件信息
	 * TODO(这里用一句话描述这个方法的作用) @param @param sign @param @return 参数 @return String
	 * 返回类型 @throws
	 */
	public String getProperties(String sign) {
		InputStream in = getClass().getResourceAsStream("/config/custom.properties");
		Properties prop = new Properties();
		String properties = "";
		try {
			prop.load(in);
			properties = prop.getProperty(sign).toString();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if (null != in) {
					in.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return properties;
	}
	
	
	public static String getUserIpAddress() {
		String uesrIpAddress = "http://43.254.219.98:8001";
		ReadProperties rp = new ReadProperties();
		String properties = rp.getProperties("user.ip.address");
		uesrIpAddress = properties;
		return uesrIpAddress;
	}
	
	

	public static void main(String[] args) {
		ReadProperties rp = new ReadProperties();
		String properties = rp.getProperties("user.ip.address");
		System.out.println(properties);

	}

}
